<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAuthTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('user_auth')) {
            Schema::create('user_auth', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('user_id')->default(0)->comment('用户id');
                $table->string('wx_openid')        ->unique()->nullable()->comment('openid 针对微信登录用户');
                $table->string('wx_session_key') ->nullable()->comment('微信返回的状态');
                $table->string('type')->nullable()->comment('类型：wxapp：小程序 wx：微信公众号 qqapp：qq小程序');
                $table->string('nickname',64)->nullable()->comment('用户昵称');
                $table->integer('photo_id')->default(0)->comment('用户头像');
                $table->tinyInteger('sex')->default(0)->comment('性别，0：保密，1:男，2:女');
                $table->string('province',64)->nullable()->comment('省份');
                $table->string('city',64)->nullable()->comment('城市');
                $table->string('area',64)->nullable()->comment('地区');
                $table->string('qq',64)->nullable()->comment('qq');
                $table->timestamp('birthday')->nullable()->comment('出生年月日');
                $table->timestamps();
                $table->softDeletes();
            });
        }

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
